<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="false">
			<!-- <block slot="backText">返回</block> -->
			<block slot="content">首页</block>
		</cu-custom>
		<add-tip :tip="tip" :duration="duration" />

		<!-- banner图 -->
		<view class="uni-padding-wrap">
			<view class="page-section swiper">
				<view class="page-section-spacing">
					<swiper class="swiper" circular="true" indicator-dots="true" autoplay="true" interval="3500"
						duration="600">
						<swiper-item class="swiper-list" v-for="(item, index) in bannerList" :key="index">
							<view class="swiper-item uni-bg-red">
								<image class="swiper-img" :src="item.address" mode=""></image>
							</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
		</view>

		<!-- 导航栏 -->
		<view class="cu-list grid solids-bottom col-4 no-border">
			<view class="cu-item" v-for="(item, index) in categories" :key="index"
				:style="[{ animation: 'show ' + ((index + 1) * 0.2 + 1) + 's 1' }]" @click="goCategorieslist"
				:data-mid="item.mid">
				<view :class="['cuIcon-' + item.cuIcon, 'text-' + item.color]" style="font-size: 100upx;">
					<view class="cu-tag badge" v-if="item.count != 0">
						<block v-if="item.badge != 1">{{ item.badge > 99 ? '99+' : item.badge }}</block>
					</view>
				</view>
				<view class="cu-item-font">{{ item.name }}</view>
			</view>
		</view>


		<view class="message-box">
			<view class="page-section swiper">
				<view class="page-section-spacing">
					<swiper style="height: 120rpx;" class="swiper" vertical="ture" circular="true"
						indicator-dots='false' indicator-color="rgba(0,0,0,.0)" indicator-active-color="rgba(0,0,0,.0)"
						autoplay="true" interval="4000">
						<swiper-item class="swiper-list" v-for="(item, index) in messageData" :key="index">
							<view class="message-tltle">{{item.title}}</view>
							<view class="message-content"><span>{{item.tag}}</span>{{item.content}}</view>
						</swiper-item>
					</swiper>
				</view>
			</view>
		</view>

		<view class="cu-bar bg-white margin-top-xs">
			<view class="action sub-title">
				<text class="text-xl text-bold text-green text-shadow">入门课程</text>
				<text class="text-ABC text-green">curriculum</text>
			</view>
			<view class="action" @click="goVideo"><text class="text-lg text-grey text-shadow">更多</text></view>
		</view>

		<view class="skill-sequence-panel-content-wrapper">
			<!--左边虚化-->
			<view class="hide-content-box hide-content-box-left"></view>
			<!--右边虚化-->
			<view class="hide-content-box hide-content-box-right"></view>
			<scroll-view scroll-x="true" class="kite-classify-scroll">
				<view class="kite-classify-cell shadow" v-for="(item, index) in curriculum" :key="index">
					<view :class="'nav-li bg-index' + (index + 1)">
						<view class="nav-name">{{ item.name }}</view>
					</view>
					<view class="nav-content">{{ item.content }}</view>
					<view v-if="index === 0" @click="goVideo" class="nav-btn shadow" :class="'bg-index' + (index + 1)">
						立即了解</view>
					<!-- <view @click="goVideo" class="nav-btn shadow" :class="'bg-index' + (index + 1)">立即了解</view> -->
					<view v-if="index === 1" @click="goVideo1" class="nav-btn shadow" :class="'bg-index' + (index + 1)">
						立即了解</view>
					<view v-if="index === 2" @click="goVideo2" class="nav-btn shadow" :class="'bg-index' + (index + 1)">
						立即了解</view>
					<view v-if="index === 3" @click="goVideo3" class="nav-btn shadow" :class="'bg-index' + (index + 1)">
						立即了解</view>
				</view>
			</scroll-view>
		</view>
		<view style="height: 140rpx;width: 1rpx;"></view>
	</view>
</template>

<script>
	import request from '@/common/request.js';
	import addTip from '../../components/wxcomponents/struggler-uniapp-add-tip/struggler-uniapp-add-tip.vue';
	export default {
		data() {
			return {
				tip: '红鲤鱼与绿鲤鱼组倾情制作',
				duration: 1,
				scrollTop: 0,
				old: {
					scrollTop: 0
				},

				bannerList: [{
						address: '../../static/swiper/picture1.png'
					},
					{
						address: '../../static/swiper/picture2.png'
					},
					{
						address: '../../static/swiper/picture3.png'
					},
					{
						address: '../../static/swiper/picture4.png'
					}
				],
				categories: [{
						cuIcon: 'goodsnewfill',
						color: 'green',
						badge: 9,
						mid: '1',
						name: '院校地图',
					},
					{
						cuIcon: 'colorlens',
						color: 'green',
						badge: 9,
						mid: '2',
						name: '院校确立'
					},
					{
						cuIcon: 'hotfill',
						color: 'red',
						badge: '火爆',
						mid: '3',
						name: '考研计划'
					},
					{
						cuIcon: 'calendar',
						color: 'green',
						badge: 9,
						mid: '4',
						name: '温馨港湾'
					}
				],
				messageData: [{
						title: '2022考研时间',
						tag: '重点',
						content: '12月25日-12月26日'
					},
					{
						title: '2023考研',
						tag: '建议',
						content: '搜集考研院校，整理考研计划'
					}
				],
				curriculum: [{
						name: '院校的选择',
						content: '考察408的院校主要集中在北上广发达地区...'
					},
					{
						name: '是否跨考专业',
						content: '跨考考研指的是考研时跨专业、跨地区、跨学校...'
					},
					{
						name: '专学硕区别',
						content: '专业硕士即学术型硕士是和普通的硕士一起参加全国统考...'
					},
					{
						name: '考研科目分析',
						content: '考研科目分为4门，2门公共课、1门专业课和1门基础课...'
					},
				],
				projectList: []
			};
		},
		watch: {},
		mounted() {
			console.log(this.projectList);
			this.getData();
		},
		methods: {
			getData() {
				console.log('数据加载');
				let opts = {
					url: 'json/project.json',
					method: 'get'
				};
				uni.showLoading({
					title: '加载中'
				});
				request.httpRequest(opts).then(res => {
					console.log(res);
					uni.hideLoading();
					if (res.statusCode == 200) {
						this.projectList = res.data.data;
					} else {}
				});
			},
			scroll: function(e) {
				console.log(e);
				this.old.scrollTop = e.detail.scrollTop;
			},
			goCategorieslist: function(e) {
				//console.log(e.currentTarget.dataset.mid)
				if (e.currentTarget.dataset.mid == 2) {
					//console.log("wojinlaile")
					uni.navigateTo({
						url: 'chooseUniversity/chooseUniversity'
					});
				} else if (e.currentTarget.dataset.mid == 1) {
					uni.switchTab({
						url: '../graph/graph'
					});
				}else if (e.currentTarget.dataset.mid == 3) {
					uni.navigateTo({
						url: 'Plans2/Plans2'
					});
				} else if (e.currentTarget.dataset.mid == 4) {
					uni.navigateTo({
						url: 'warmStart/warmStart'
					})
				}
			},
			goProjectList() {
				uni.navigateTo({
					url: 'project/list'
				});
			},
			goProject(id) {
				uni.navigateTo({
					url: 'project/project?proId=' + id
				});
			},
			goVideo() {
				uni.navigateTo({
					url: 'video/video'
				});
			},
			goVideo1() {
				uni.navigateTo({
					url: 'video/video1/video1'
				});
			},
			goVideo2() {
				uni.navigateTo({
					url: 'video/video2/video2'
				});
			},
			goVideo3() {
				uni.navigateTo({
					url: 'video/video3/video3'
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}

	.cu-item-font {
		font-size: 35upx;
	}

	.message-box {
		width: 100%;
		height: 120rpx;
		background: url(https://zhoukaiwen.com/img/icon/clock.gif) #FFFFFF;
		background-repeat: no-repeat;
		background-size: 100rpx 100rpx;
		background-position: 15rpx 10rpx;
		margin: 0rpx 0rpx 10rpx 0rpx;
		padding-left: 130rpx;

		.message-tltle {
			color: #18BC37;
			height: 65rpx;
			line-height: 70rpx;
			font-weight: 600;
			font-size: 28rpx;
		}

		.message-content {
			color: #4CD964;

			span {
				background-color: #DD6161;
				color: #FFFFFF;
				padding: 2rpx 8rpx;
				border-radius: 8rpx;
				margin-right: 8rpx;
			}
		}
	}

	/*scroll-view外层*/
	.skill-sequence-panel-content-wrapper {
		position: relative;
		white-space: nowrap;
		padding: 10rpx 0 10rpx 10rpx;
	}

	/*左右渐变遮罩*/
	.hide-content-box {
		position: absolute;
		top: 0;
		height: 100%;
		width: 10px;
		z-index: 2;
	}

	.hide-content-box-left {
		left: 0;
		background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
	}

	.hide-content-box-right {
		right: 0;
		background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
	}

	.kite-classify-scroll {
		width: 100%;
		height: 380rpx;
		overflow: hidden;
		white-space: nowrap;
	}

	.kite-classify-cell {
		display: inline-block;
		width: 300rpx;
		height: 390rpx;
		margin-right: 20rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		overflow: hidden;
		box-shadow: 2px 2px 3px rgba(26, 26, 26, 0.2);
	}

	.nav-li {
		padding: 40rpx 30rpx;
		width: 100%;
		background-image: url(https://s1.ax1x.com/2020/06/27/NyU04x.png);
		background-size: cover;
		background-position: center;
		position: relative;
		z-index: 1;
	}

	.nav-name {
		font-size: 35upx;
		text-transform: Capitalize;
		margin-top: 20upx;
		position: relative;
		font-weight: bold;
	}

	.nav-name::before {
		content: '';
		position: absolute;
		display: block;
		width: 40rpx;
		height: 6rpx;
		background: #fff;
		bottom: 0;
		right: 0;
		opacity: 0.5;
	}

	.nav-name::after {
		content: '';
		position: absolute;
		display: block;
		width: 100rpx;
		height: 1px;
		background: #fff;
		bottom: 0;
		right: 40rpx;
		opacity: 0.3;
	}

	.nav-content {
		width: 100%;
		padding: 15rpx;
		display: inline-block;
		overflow-wrap: break-word;
		white-space: normal;
		font-size: 30upx;
	}

	.nav-btn {
		width: 200rpx;
		height: 60rpx;
		margin: 8rpx auto;
		text-align: center;
		line-height: 60rpx;
		border-radius: 10rpx;
	}

	.bg-index1 {
		background-color: #19cf8a;
		color: #fff;
	}

	.bg-index2 {
		background-color: #954ff6;
		color: #fff;
	}

	.bg-index3 {
		background-color: #5177ee;
		color: #fff;
	}

	.bg-index4 {
		background-color: #f49a02;
		color: #fff;
	}

	.bg-index5 {
		background-color: #ff4f94;
		color: #fff;
	}

	.bg-index6 {
		background-color: #7fd02b;
		color: #fff;
	}

	.item-name {
		margin-bottom: 15rpx;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 1;
		overflow: hidden;
	}
</style>
